﻿<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="utf-8" />
    <meta name="keywords" content=" " />
    <meta name="description" content=" " />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="format-detection" content="telephone=no" />
    <title>闪电极送</title>
    <link rel="stylesheet" href="css/regeister-css/base.css">
    <link rel="stylesheet" href="css/regeister-css/logoin2.css">
    <script src="../scripts/jquery/jquery-1.10.1.min.js"></script>
    <script type="text/javascript">
        function DownLoad() {
            var userSystem = navigator.userAgent;
            if (userSystem.indexOf("Android") > 0) {
                location.href = "https://fir.im/qsld?utm_source=fir&utm_medium=qr"; //安卓

            } else if (userSystem.indexOf("iPhone") > 0) {
                location.href = "https://itunes.apple.com/us/app/闪电极送/id1214140725?l=zh&ls=1&mt=8"; //苹果
            }
        }
    </script>
    <script>
        $(function() {
            var currentUrl = "http://www.sdjs.top"
                //获取验证码
            $("#getCode").click(function() {
                var phone = $("#phone").val();
                var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                if (!myreg.test(phone)) {
                    alert('请输入有效的手机号码！');
                    return false;
                }
                $.ajax({
                    type: "post", //请求方式：post，get  
                    url: currentUrl + "/wxsdjs/codehandler.ashx", //请求的页面  
                    data: {
                        "Type": "2",
                        "phone": phone
                    }, //请求参数  
                    dataType: "json",
                    //请求成功执行的方法，function内参数名随意，不影响  
                    success: function(result) {
                        if (result.IsOk == false) {
                            alert(result.Msg);
                            if (result.Msg == "手机号已注册") {
                                window.location.href = "html/code_sharing.html";
                            } else {
                                return false
                            }
                        } else if (result.IsOk == true) {
                            sendcodeTime();
                        }
                    },
                    //请求执行异常执行的方法  
                    error: function() {
                        alert("验证码接口错误");
                    }
                });
            });
            //禁用发送验证码控件60s
            function sendcodeTime() {
                var btnSend = $(".password01");
                var msg = $('.count');
                btnSend.removeAttr('style').attr('style', 'display:none;');
                msg.removeAttr('style').attr('style', 'display:block');
                var left_time = 60;
                var tt = window.setInterval(function() {
                    left_time = left_time - 1;
                    if (left_time <= 0) {
                        window.clearInterval(tt);
                        msg.val('60秒后可重发');
                        msg.removeAttr('style').attr('style', 'display:none;');
                        btnSend.removeAttr('style').attr('style', 'display:block');
                    } else {
                        msg.val('' + left_time + '秒后可重发');
                    }
                }, 1000);
            };
            // 密码显隐
            $(".showPwd").click(function() {
                    if ($("#Pwd").attr("type") == "password") {
                        $("#Pwd").prop('type', "text");
                        $(this).attr("src", "img/regeister/hidePwd.png");
                    } else if ($("#Pwd").attr("type") == "text") {
                        $("#Pwd").prop('type', "password");
                        $(this).attr("src", "img/regeister/showPwd.png");
                    }

                })
                ///用户注册
            $("#btn").click(function() {
                var phone = $("#phone").val();
                var voidCode = $("#voidCode").val();
                var Pwd = $("#Pwd").val();
                if (phone == "" || voidCode == "" || Pwd == "") {
                    alert("数据不完整");
                    return;
                };
                if (Pwd.length < 6 || Pwd.length > 20) {
                    alert("密码长度请设置到6-20位");
                    return false;
                };
                $.ajax({
                    type: "post", //请求方式：post，get  
                    url: currentUrl + "/wxsdjs/userhandler.ashx?type=2", //请求的页面  
                    data: {
                        "phone": phone,
                        "voidCode": voidCode,
                        "Pwd": Pwd
                    }, //请求参数  
                    dataType: "json",
                    //请求成功执行的方法，function内参数名随意，不影响  
                    success: function(result) {
                        if (result.IsOk == false) {
                            alert(result.Msg);
                            if (result.Msg == "手机号已注册") {
                                window.location.href = "html/code_sharing.html";
                            } else {
                                return false
                            }
                        } else if (result.IsOk == true) {
                            alert("注册成功")
                            window.location.href = "html/code_sharing.html";
                            // return;
                        }
                    },
                    //请求执行异常执行的方法  
                    error: function() {
                        alert("注册参数或接口错误");
                    }
                });

            });

        })
    </script>
</head>

<body>
    <div id="main" class="login_bg">
        <header>
            <div class="login">
                <div class="login_add">闪电极送</div>
                <form name="login">
                    <fieldset>
                        <div class="tel">
                            <label>
                                <img src="img/regeister/reg_01.png" /></label>
                            <input type="tel" id="phone" maxlength="11" placeholder="输入手机号" class="login_inp01" />
                            <input id="Button1" type="button" value="60秒后可重发" style="display: none;" class="count" />
                            <input type="button" id="getCode" value="获取验证码" class="password01" />
                        </div>

                        <div class="password">
                            <label>
                                <img src="img/regeister/reg_02.png" /></label>
                            <input type="text" id="voidCode" placeholder="输入验证码" class="login_inp02" />
                        </div>
                        <div class="password">
                            <label>
                                <img src="img/regeister/reg_02.png" /></label>
                            <input type="password" id="Pwd" placeholder="输入密码" class="login_inp02" />
                            <img src="img/regeister/showPwd.png" alt="" class="showPwd" />
                        </div>
                        <div class="clear"></div>
                        <div class="reg">
                            <div class="addchecked add_on">
                                <input type="checkbox" class="addclass" /></div>
                            <label>我已阅读并同意用户协议<a href="#">《用户协议》</a></label>
                        </div>
                        <button id="btn" type="button" class="reg_btn">新用户注册</button>

                    </fieldset>
                </form>
            </div>
        </header>
    </div>

</body>

</html>